package DesignPattern.simpleFactory;

/**
 * @Author self
 * @Date 2024/8/11 16:54
 */
public class ProductFactory {
    public Product createProduct(String type) {
        if (type.equalsIgnoreCase("A")) {
            return new ConcreteProductA();
        } else if (type.equalsIgnoreCase("B")) {
            return new ConcreteProductB();
        } else {
            throw new IllegalArgumentException("Unknown product type: " + type);
        }
    }
}

